             package com.java.diagnostics.visualizer.recommender;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             import java.text.MessageFormat;
             
             public class CalculateRateOfGarbageCollection
               extends RecommendationBase
               implements Recommendation
             {
               private static final double ALMOST_ZERO = 1.E-009D;
               
               public void recommend(AggregateData data)
               {
                 TupleData amountFreed = data.getTupleData("VGCLabels.amount.freed");
                 if ((amountFreed != null) && (!amountFreed.isEmpty())) {
                   String xUnits = VGCAxes.MINUTES;
                   String yUnits = VGCAxes.MB;
                   double totalAmountFreed = amountFreed.getTotalY(yUnits);
                   double timeSpan = amountFreed.getMaxX(xUnits) - 
                     amountFreed.getMinX(xUnits);
                   
                   if (timeSpan > 1.E-009D) {
                     double rate = totalAmountFreed / timeSpan;
                     addToSummary(data, 
                       MessageFormat.format(RecommendationLabels.RATE_OF_GARBAGE_COLLECTION, new Object[] { yUnits, xUnits }), new Double(rate));
                   }
                 }
               }
             }


